from django.http import JsonResponse

def ajax(request):
    print("后端ajax")
    if request.method=='GET':
        print(request.GET)
        return JsonResponse({'ret':0, 'way':'get', 'id':'123'})
    elif request.method=='POST':
        print(request.body)
        return JsonResponse({'ret':0, 'way':'post', 'id': '456'})
    print('ajax结束')